﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Dispose.aspx.cs" Inherits="HHWeb.SystemManage.Users.Dispose" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>后台管理-<%=Command== "Add" ? "添加" : "修改"%>用户</title>
<link href="../../Css/backCommon.css" rel="stylesheet" type="text/css" />
<link href="../../Css/UpImgStyle.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <input type="hidden" id="Command" name="Command" value="<%=Command %>" />
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td height="30px" background="../../images/tab_05.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="12px" height="30px"><img src="../../images/tab_03.gif" width="12px" height="30px"/></td>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="46%" valign="middle"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="5%"><div align="center"><img src="../../images/tb.gif" width="16px" height="16px" /></div></td>
                <td width="95%" class="STYLE1"><span class="STYLE3">你当前的位置</span>：[用户管理]-[<%=Command== "Add" ? "添加" : "修改"%>用户]</td>
              </tr>
            </table></td>
            <td width="54%">&nbsp;</td>
          </tr>
        </table></td>
        <td width="16px"><img src="../../images/tab_07.gif" width="16px" height="30px" /></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="8px" background="../../images/tab_12.gif">&nbsp;</td>
        <td>
        <%--Submit数据区头--%>
        <table id="EditArea" border="0" cellpadding="0" cellspacing="0" width="100%">
            <tr><td><span><font color="red">*</font>用户编号：</span></td>
                <td><input type="text" id="UserNumber" name="UserNumber" class="TextCommon" readonly="readonly" value="<%=UserNumber %>" />
                </td></tr>
            <tr><td><span><font color="red">*</font>用户名：</span></td>
                <td>
                    <input type="text" <%if(Command=="Update"){ %> readonly="readonly"<%} %> id="UserName" name="UserName" class="TextCommon" value="<%=UserName %>" />
                </td></tr>
            <tr><td><span><font color="red">*</font>登录账号：</span></td>
                <td>
                    <input type="text" id="UserCode" name="UserCode" class="TextCommon" value="<%=UserCode %>" /><img id="CheckUserCode" src="../../images/onSuccess.gif" name="" alt="" style="display:none;width:22px; height:22px" />
                </td></tr>
            <%if(Command != "Update"){ %>
            <tr><td><span><font color="red">*</font>用户密码：</span></td>
                <td>
                    <input type="password" id="UserPassWord" name="UserPassWord" class="TextCommon" value="" />
                </td></tr>
            <tr><td><span><font color="red">*</font>重新输入密码:</span></td>
                <td>
                <input type="password" name="repassword" id="repassword" class="TextCommon" value=""/><span id="CheckPwd"></span>
                </td></tr>
            <%} %>
           <tr><td><span><font color="red">*</font>用户图像：</span></td><td>
           <div id="preview_fake"><img id="preview" src="<%=UserPicUrl %>" class="preview_fake" style=" width:100px; height:100px;" /></div>     
           <div style="padding-top:65px;"><input id="upload_img" runat="server" type="file" onkeydown="event.returnValue=false;" onpaste="return flase" onchange="onUploadImgChange(this)"/>
           (图片格式：".gif"，".jpg"，".bmp"，".png")
           <img id="preview_size_fake"/></div>
           <input type="hidden" id="ImgUrl" name="ImgUrl" value="<%=UserPicUrl %>" />
           </td></tr>
            <tr>
                <td><span><font color="red">*</font>联系电话：</span></td>
                <td><input type="text" id="UserTel" name="UserTel" class="TextCommon" value="<%=UserTel %>"" /><img id="CheckUserTel" src="../../images/onError.gif" name="" alt="" style="display:none;width:22px; height:22px" />
                </td></tr>
            <tr>
                <td><span>邮箱：</span></td>
                <td><input type="text" id="UserEmail" name="UserEmail" class="TextCommon" value="<%=UserEmail %>"" /><img id="CheckUserEmail" name="../../images/onError.gif"  src="" alt="" style="display:none; width:22px; height:22px" />
                </td></tr>
            <tr>
                <td><span>个性签名：</span></td>
                <td>
                <textarea id="Signature" name="Signature" class="TextCommon" style=" width:500px; height:40px;" ><%=Signature %></textarea>
                </td></tr>
            <tr>
                <td><span>用户类型：</span></td>
                <td>
                    <select id="UserType" name="UserType" class="Common">
                        <option value="1" <%=UserType=="1"?"selected=selected":"" %>>系统管理员</option>
                        <option value="0" <%=UserType=="0"?"selected=selected":"" %>>普通管理员</option>
                    </select>
                </td>
            </tr>
            <tr><td><span>地址：</span></td>
            <td><textarea id="UserAddress" name="UserAddress" class="TextCommon" style=" width:500px; height:40px; "><%=UserAddress %></textarea></td>
            </tr>
            </tr>
            <tr><td><span>用户状态：</span></td>
            <td><input type="radio" id="OpenState1" name="OpenState" <%=OpenState==1?"checked=checked":"" %> value="1"/>启用
                <input type="radio" id="OpenState0" name="OpenState" <%=OpenState==0?"checked=checked":"" %> value="0"/>禁用
                </td></tr>
            <tr><td><span><font color="red">*</font>排序号：</span></td>
            <td><input type="text" id="Sort" name="Sort" class="TextCommon" value="<%=Sort %>" /></td>
            </tr>
            <tr><td><span>创建人：</span></td>
                <td><input type="text" id="Creater" name="Creater" class="TextCommon" readonly="readonly" value="<%=Creater %>" /></td>
            </tr>
            <tr><td><span>创建时间：</span></td>
                <td><input type="text" id="CreateTime" name="CreateTime" class="TextCommon" readonly="readonly" value="<%=CreateTime %>" />
                </td></tr>
            <tr><td>&nbsp;</td>
                <td>
                <input type="button" id="BTSubmit" name="BTSubmit" class="Common" value="确定" /><input type="button" id="BTCancel" name="BTCancel" class="Common" value="取消" />
                </td></tr>
        </table>
       <%--Submit数据区尾--%>
        </td>
        <td width="8px" background="../../images/tab_15.gif">&nbsp;</td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td height="35px" background="../../images/tab_19.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="12px" height="35px"><img src="../../images/tab_18.gif" width="12px" height="35px" /></td>
        <td>
        <%--分页区头--%>
        <%--分页去尾--%>
        </td>
        <td width="16px"><img src="../../images/tab_20.gif" width="16px" height="35px" /></td>
      </tr>
    </table></td>
  </tr>
</table>
<%--Jquery验证区Start--%>
<script src="../../Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script src="../../JS/FormCommon.js" type="text/javascript"></script>
<script src="../../JS/PreviewIMG.js" type="text/javascript"></script> 
     <script type="text/javascript" language="javascript">
         $(function () {
             var com = '<%=Command %>';
             $("#BTSubmit").click(function () {
                 if ($("#UserNumber").val() == "" || $("#UserNumber").val() == null) {
                     alert("用编号不能为空！");
                     $("#UserNumber").focus();
                     return;
                 }
                 if ($("#UserName").val() == "" || $("#UserName").val() == null) {
                     alert("用户名不能为空！");
                     $("#UserName").focus();
                     return;
                 }
                 if ($("#UserCode").val() == "" || $("#UserCode").val() == null) {
                     alert("登录账号不能为空！");
                     $("#UserCode").focus();
                     return;
                 }
                 if (com == "Add") {
                     if ($("#UserPassWord").val() == "" || $("#UserPassWord").val() == null) {
                         alert("密码不能为空！");
                         $("#UserPassWord").focus();
                         return;
                     }
                     if ($("#repassword").val() == "" || $("#repassword").val() == null) {
                         alert("确认密码不能为空！");
                         $("#repassword").focus();
                         return;
                     }
                     if ($("#UserPassWord").val() != $("#repassword").val()) {
                         alert("两次输入的密码不一样！");
                         $("#repassword").focus();
                         return;
                     }
                 }
                 if ($("#ImgUrl").val() == "" || $("#ImgUrl").val() == null) {
                     if ($("#upload_img").val() == "" || $("#upload_img").val() == null) {
                         alert("用户头像不能为空！");
                         return;
                     }
                 }
                 if ($("#UserTel").val() == "" || $("#UserTel").val() == null) {
                     alert("用户联系电话不能为空！");
                     $("#UserTel").focus();
                     return;
                 }
                 if ($("#Sort").val() == "" || $("#Sort").val() == null) {
                     alert("排序号不能为空！");
                     $("#Sort").focus();
                     return;
                 }
                 if ($("img[name='Error']").length > 0) {
                     alert("填写信息有误！");
                     return;
                 }
                 $("#form1").attr("method", "POST");
                 $("#form1").submit();
             });
             var Validator = { Email: /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/,
                 TelePhone: /^1([3458]\d|5[123456789])\d{8}$/
             };
             $("#repassword").keyup(function () {
                 if ($("#UserPassWord").val() != $(this).val()) {
                     $("#CheckPwd").html("<font color=\"red\">两次输入的密码不一样！</font>")
                 }
                 else {
                     $("#CheckPwd").html("两次输入的密码正确！")
                 }
             });
             //验证登录帐号
             $("#UserCode").keyup(function () {
                 $("#CheckUserCode").css("display", "");
                 $.ajax({
                     type: "POST",
                     url: "../../Handler/CheckUserCode.ashx",
                     data: "UserCode=" + $(this).val() + "&UserNumber=" + $("#UserNumber").val() + "&Command=" + com + "&rd=" + Math.random() + "",
                     success: function (data) {
                         if (parseInt(data) == 1) {
                             $("#CheckUserCode").attr({ "src": "../../images/onError.gif", "alt": "该登录帐号已存在！", "name": "Error" });
                         }
                         else {
                             $("#CheckUserCode").attr({ "src": "../../images/onSuccess.gif", "alt": "该帐号可用！", "name": "Success" });
                         }
                     }
                 })
             });
             //联系电话验证
             $("#UserTel").keyup(function () {
                 $("#CheckUserTel").css("display", "");
                 if (!Validator.TelePhone.exec($(this).val())) {
                     $("#CheckUserTel").attr({ "src": "../../images/onError.gif", "title": "联系电话格式错误！", "alt": "联系电话格式错误！", "name": "Error" });
                 }
                 else {
                     $("#CheckUserTel").attr({ "src": "../../images/onSuccess.gif", "title": "联系电话格式正确！", "alt": "联系电话格式正确！", "name": "Success" });
                 }
             });
             //联系电话验证
             $("#UserEmail").keyup(function () {
                 if ($(this).val() != "" && $(this).val() != null) {
                     $("#CheckUserEmail").css("display", "");
                     if (!Validator.Email.exec($(this).val())) {
                         $("#CheckUserEmail").attr({ "src": "../../images/onError.gif", "title": "邮箱格式错误！", "alt": "邮箱格式错误！", "name": "Error" });
                     }
                     else {
                         $("#CheckUserEmail").attr({ "src": "../../images/onSuccess.gif", "title": "邮箱格式正确！", "alt": "邮箱格式正确！", "name": "Success" });
                     }
                 }
                 else {
                     $("#CheckUserEmail").css("display", "none");
                 }
             });
         })         
    </script>
<%--Jquery验证区End--%>
</form>
</body>
</html>
